﻿// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "BaseCharacter.h"
#include "Actor/HealthPack.h"
#include "BehaviorTree/BehaviorTree.h"
#include "Components/WidgetComponent.h"
#include "UMG/HealthBarWidget.h"
#include "EnemyCharacter.generated.h"

UCLASS()
class COMBAT_GAME_CPP_API AEnemyCharacter : public ABaseCharacter
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	AEnemyCharacter();
	// Called every frame
	virtual void Tick(float DeltaTime) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:
	//********************************************************* 组件
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	UWidgetComponent* WidgetComponent;

	//********************************************************* 成员变量属性
	// 是否受伤状态 用于判断ai行为树执行跟踪task
	// UPROPERTY(BlueprintReadWrite, EditAnywhere)
	// bool IsDamage_AI = false;


	// AI行为树
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	UBehaviorTree* BehaviorTree;

	//	攻击动画
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	UAnimMontage* AttackMontage;

	//血条widget
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	TSubclassOf<UHealthBarWidget> HealthBarWidgetClass;

	//********************************************************* 成员方法
	// 攻击
	void PlayAttackMontage() override;

	//*********************************************** 抽象实现
	UFUNCTION(BlueprintCallable)
	virtual void AttackDamage() override;

	UFUNCTION(BlueprintCallable)
	virtual void TakeHitDamage(const float DamageValue) override;

	UFUNCTION(BlueprintCallable)
	virtual void DeathClear() override;

	UFUNCTION(BlueprintCallable)
	void DestroySelf();

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UParticleSystem* DeathParticle;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TSubclassOf<AHealthPack> HealthPackClass;
};
